<template>
	<view>
		<CustomNavbar :title="pageTitle">
			<view slot="left">
				<image class="back-btn" src="@/static/iocn57.png" mode="aspectFit" @click="onBack" />
			</view>
			<view slot="right">
				<uni-icons type="plus-filled" size="30" @click="toreciveFleet()"></uni-icons>
			</view>
		</CustomNavbar>
		<view class="body">
			<view class="container" v-for="(item,index) in list" @click="tofleetxiangqing(item)">
				<view class="fr">
					<view class="text_a">{{item.trueName}}</view>
					<view class="text_b">手机号: {{item.mobile}}</view>
					<view class="text_b">车牌号: {{item.carNumber}}</view>
					<!-- <view class="text_c" @click="shanchushow = true">删除</view>
					<view class="text_c" @click="torevise(item)">修改</view> -->
				</view>
				<view>
					<u-modal :show="shanchushow" :showCancelButton="true" @confirm="confirms(item)" @cancel="cancel"
						title="确定删除" :content="content"></u-modal>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		GetDrivers
	} from '@/public/Api/update.js'
	import {
		setValue,
		getValue
	} from '@/public/storeage/index.js'
	import CustomNavbar from '@/components/CustomNavbar.vue'
	export default {
		components: {
			CustomNavbar
		},
		data() {
			return {
				skipCount: 0,
				maxResultCount: 10,
				pageIndex: 1,
				pageTitle: '车队管理',
				list: []
			}
		},
		onLoad() {
			this.GetDrivers()
		},
		methods: {
			toreciveFleet() {
				uni.navigateTo({
					url: '/pages/PersonalCenter/reciveFleet'
				})
			},
			onBack() {
				uni.reLaunch({
					url: '/pages/PersonalCenter/index'
				})
			},
			tofleetxiangqing(item) {
				uni.navigateTo({
					url: '/pages/PersonalCenter/fleetxiangqing?trueName=' +item.trueName+'&mobile='+item.mobile+'&carNumber='+item.carNumber+'&length='+item.truck.length+'&load='+item.truck.load+'&style='+item.truck.style

				})
			},
			async GetDrivers() {
				var skipCount = (this.pageIndex - 1) * this.maxResultCount
				var maxResultCount = this.maxResultCount
				var parentId = getValue('id')
				try {
					const {
						data: res
					} = await GetDrivers({
						skipCount,
						maxResultCount,
						parentId
					})
					this.list = res.result.items
					console.log(res)
				} catch (e) {}

			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f7f7f7;
		padding: 15upx;
	}

	.back-btn {
		width: 24px;
		height: 24px;
	}

	.navbar-btn {
		font-size: 14px;
	}

	.body {
		margin-top: 30upx;
	}

	.container {
		border-radius: 17upx;
		background: #FFFFFF;
		box-shadow: 1.75upx 1.75upx 7.01upx 0px #e5e5e5, 1.75upx 1.75upx 7.01upx 0px #e5e5e5;
		padding: 10upx 10upx;
		margin-top: 20upx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.fr {
			width: 100%;
			padding-left: 20upx;

			.text_a {
				font-size: 32upx;
				color: #000;
				font-weight: bold;
				margin-top: 10upx;
			}

			.text_d {
				font-size: 30upx;
				color: #383838;
				margin-top: 10upx;
			}

			.text_b {
				text {
					font-size: 30upx;
					color: #383838;
					margin: 20upx 0;
				}
			}

			.text_c {
				width: 133upx;
				height: 51upx;
				background-color: #ef4d3d;
				font-size: 24upx;
				color: #fff;
				text-align: center;
				line-height: 51upx;
				border-radius: 10upx;
				margin-top: 30upx;
				float: right;
				margin-right: 10upx;
			}
		}
	}
</style>
